#include "widget.h"
#include "ui_widget.h"
#include <QDebug>
#include <QMessageBox>

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
    , _pVLCKits(new VLCKits(this))
{
    ui->setupUi(this);

    bool ret = _pVLCKits->initVLC();
    if (!ret) {
        QMessageBox::warning(this, "Error", "initVLC failed!");
        exit(EXIT_FAILURE);
    }
}

Widget::~Widget()
{
    delete ui;
}

void Widget::on_btnOpen_clicked()
{
    QString url = ui->urlLineEdit->text();
    qDebug() << "url:" << url;
    _pVLCKits->playURL(url, (void *)ui->videoWidget->winId());
}
